import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsIn, IsInt, IsNumber, IsOptional, IsString } from 'class-validator';

export class CreateCarInfoDto {
  @ApiProperty({
    description: '型号id',
  })
  @Type(() => Number)
  model_id: number;

  @ApiProperty({
    description: '名称',
  })
  @IsString()
  name: string;

  @ApiProperty({
    description: '信息',
  })
  @IsString()
  content: string;

  @ApiProperty({
    description: '车型',
  })
  @IsOptional()
  @IsIn(['0', '1', '2', '3', '4', '5', '6', '7', '8'])
  car_model: string;

  @ApiProperty({
    description: '排量',
  })
  @IsString()
  displacement: string;

  @ApiProperty({
    description: '座位数',
  })
  @Type(() => Number)
  seating: number;

  @ApiProperty({
    description: '驱动方式',
  })
  @IsString()
  drive: string;

  @ApiProperty({
    description: '能源',
  })
  @IsString()
  energy: string;

  @ApiProperty({
    description: '价格',
  })
  @IsString()
  price: string;

  @ApiProperty({
    description: '长度（mm）',
  })
  @Type(() => Number)
  length: number;

  @ApiProperty({
    description: '宽度（mm）',
  })
  @Type(() => Number)
  width: number;

  @ApiProperty({
    description: '油箱容积L',
  })
  @Type(() => Number)
  tank: number;

  @ApiProperty({
    description: '气缸数（个）',
  })
  @Type(() => Number)
  cylinder: number;

  @ApiProperty({
    description: '上市时间',
  })
  @IsString()
  list_time: string;
}
